<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="zh-CN">
<head><meta name="generator" content="Hexo 3.9.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/css/main.css?v=6.4.0" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '6.4.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: 'CSXZLYKER1',
      apiKey: 'ed0357b28f9389115502dc05a109303a',
      indexName: 'wudong.tech',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"我们没有找到任何搜索结果: ${query}","hits_stats":"找到约${hits}条结果（用时${time}ms）"}
    }
  };
</script>


  




  <meta name="description" content="前言声明背景&amp;emsp;&amp;emsp;作者的博客是基于码云上搭建，所以在接入评论系统，自然也是首选码云。网上Hexo+码云搭建博客的教程也很多，唯独没找到怎么接入码云的评论系统。 &amp;emsp;&amp;emsp;既然网上没有现成的，那就自己动手。码云和Github区别不是很大，Github有的功能码云基本上都有。网上有接入Github评论系统的教程，那么我就直接拿来主义，根据网上开源的Github评论系统的">
<meta name="keywords" content="博客,Hexo,码云,评论系统">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo接入码云评论系统">
<meta property="og:url" content="https://wudong.tech/2018/08/29/Hexo接入码云评论系统/index.html">
<meta property="og:site_name" content="吴栋的博客">
<meta property="og:description" content="前言声明背景&amp;emsp;&amp;emsp;作者的博客是基于码云上搭建，所以在接入评论系统，自然也是首选码云。网上Hexo+码云搭建博客的教程也很多，唯独没找到怎么接入码云的评论系统。 &amp;emsp;&amp;emsp;既然网上没有现成的，那就自己动手。码云和Github区别不是很大，Github有的功能码云基本上都有。网上有接入Github评论系统的教程，那么我就直接拿来主义，根据网上开源的Github评论系统的">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/%E7%A0%81%E4%BA%91%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A81.png">
<meta property="og:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/%E7%A0%81%E4%BA%91%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A82.png">
<meta property="og:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/repo%E9%85%8D%E7%BD%AE.png">
<meta property="og:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/landscape-index.png">
<meta property="og:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/landscape-article.png">
<meta property="og:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/next-index.png">
<meta property="og:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/next-comments.png">
<meta property="og:image" content="https://giteement.oss-cn-beijing.aliyuncs.com/%E8%AF%84%E8%AE%BA%E6%B2%A1%E6%9C%89%E5%88%9D%E5%A7%8B%E5%8C%96.png">
<meta property="og:image" content="https://giteement.oss-cn-beijing.aliyuncs.com/%E7%99%BB%E5%BD%95%E5%90%8E%E5%87%BA%E7%8E%B0%E5%88%9D%E5%A7%8B%E5%8C%96%E6%8C%89%E9%92%AE.png">
<meta property="og:image" content="https://giteement.oss-cn-beijing.aliyuncs.com/%E5%88%9D%E5%A7%8B%E5%8C%96%E5%AE%8C%E6%88%90%E5%90%8E.png">
<meta property="og:updated_time" content="2022-10-16T06:18:19.602Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Hexo接入码云评论系统">
<meta name="twitter:description" content="前言声明背景&amp;emsp;&amp;emsp;作者的博客是基于码云上搭建，所以在接入评论系统，自然也是首选码云。网上Hexo+码云搭建博客的教程也很多，唯独没找到怎么接入码云的评论系统。 &amp;emsp;&amp;emsp;既然网上没有现成的，那就自己动手。码云和Github区别不是很大，Github有的功能码云基本上都有。网上有接入Github评论系统的教程，那么我就直接拿来主义，根据网上开源的Github评论系统的">
<meta name="twitter:image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/%E7%A0%81%E4%BA%91%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A81.png">






  <link rel="canonical" href="https://wudong.tech/2018/08/29/Hexo接入码云评论系统/">



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>Hexo接入码云评论系统 | 吴栋的博客</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">吴栋的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">非正经菜鸟程序员</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-categories">
    <a href="/categories/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br>关于</a>
  </li>

      
      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
        </li>
      
    </ul>
  

  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://wudong.tech/2018/08/29/Hexo接入码云评论系统/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="吴栋">
      <meta itemprop="description" content="技术博客，主攻Java，Python，nodeJS">
      <meta itemprop="image" content="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E5%92%8C%E7%A0%81%E4%BA%91%E6%90%AD%E5%BB%BA%E5%B1%9E%E4%BA%8E%E8%87%AA%E5%B7%B1%E7%9A%84%E5%8D%9A%E5%AE%A2/%E5%BD%A4%E5%BD%A41.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="吴栋的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Hexo接入码云评论系统
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              

              
                
              

              <time title="创建时间：2018-08-29 20:48:49" itemprop="dateCreated datePublished" datetime="2018-08-29T20:48:49+08:00">2018-08-29</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">更新于</span>
                
                <time title="修改时间：2022-10-16 14:18:19" itemprop="dateModified" datetime="2022-10-16T14:18:19+08:00">2022-10-16</time>
              
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/个人建站/" itemprop="url" rel="index"><span itemprop="name">个人建站</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="post-meta-item-icon">
            <i class="fa fa-eye"></i>
             阅读次数： 
            <span class="busuanzi-value" id="busuanzi_value_page_pv"></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="前言声明"><a href="#前言声明" class="headerlink" title="前言声明"></a>前言声明</h1><h2 id="背景"><a href="#背景" class="headerlink" title="背景"></a><blockquote style="border-left: 4px solid red;background: aqua;">背景</blockquote></h2><p>&emsp;&emsp;作者的博客是基于<a href="https://gitee.com/" target="_blank" rel="noopener">码云</a>上搭建，所以在接入评论系统，自然也是首选码云。网上<a href="https://hexo.io/zh-cn/" target="_blank" rel="noopener">Hexo</a>+码云搭建博客的教程也很多，唯独没找到怎么接入码云的评论系统。</p>
<p>&emsp;&emsp;既然网上没有现成的，那就自己动手。码云和Github区别不是很大，Github有的功能码云基本上都有。网上有接入Github评论系统的教程，那么我就直接拿来主义，根据网上开源的Github评论系统的源码基础上，修改修改，于是就有了这个Giteement基于码云的评论系统。由于能力有限，在这之前也只听说过NodeJS，因此基于NodeJS开发的这款系统，还是花费了不少时间（其实最后就是将Github评论系统里面的URL改成码云的）。</p>
<p>&emsp;&emsp;作者对于版权方面，不是很了解，如有侵权请告知。 </p>
<p>&emsp;&emsp;<strong><em> <a href="https://wudong.tech/">效果展示</a> </em></strong><br><a id="more"></a></p>
<h2 id="声明"><a href="#声明" class="headerlink" title="声明"></a><blockquote style="border-left: 4px solid red;background: aqua;">声明</blockquote></h2><p>&emsp;&emsp;系统是基于<a href="https://github.com/imsun/gitment" target="_blank" rel="noopener">gitment</a>的源码开发的。</p>
<p>&emsp;&emsp;非常感谢<a href="https://imsun.net/posts/gitment-introduction/" target="_blank" rel="noopener">Gitment原作者</a>，通过学习和阅读源码，受益匪浅。</p>
<h1 id="使用"><a href="#使用" class="headerlink" title="使用"></a>使用</h1><h2 id="必要前提"><a href="#必要前提" class="headerlink" title="必要前提"></a><blockquote style="border-left: 4px solid red;background: aqua;">必要前提</blockquote></h2><p>&emsp;&emsp;作者搭建自己的博客在码云上，就是不想花钱买服务器。但是在接入码云的第三方认证OAuth2，获取access_token的时候，出现post请求跨域问题。尝试多次，没有找到直接在前端可以跨域的方法，如果有大神知道，麻烦告知，非常感谢。</p>
<p>&emsp;&emsp;所以最终还是花钱购买了一个便宜的vps服务器，在vps服务器中安装nginx，利用nginx的反向代理实现跨域。</p>
<p>&emsp;&emsp;现在你有两种选择，一个是自己购买vps或其他主机，利用nginx反向代理跨域。第二种就是作者的vps服务器，可以提供给大家，但是需要在留言中留下你的博客域名（实在是不好意思，购买的vps服务器的每个月流量有限，所以没有全部开放，需要配置指定域名）。</p>
<h2 id="配置第三方应用"><a href="#配置第三方应用" class="headerlink" title="配置第三方应用"></a><blockquote style="border-left: 4px solid red;background: aqua;">配置第三方应用</blockquote></h2><p>&emsp;&emsp;使用码云的issues作为评论系统，就要使用码云来登录评论，所以需要在码云上配置第三方应用。<br><img src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/%E7%A0%81%E4%BA%91%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A81.png" alt><br><img src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/%E7%A0%81%E4%BA%91%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BA%94%E7%94%A82.png" alt></p>
<h2 id="配置文件"><a href="#配置文件" class="headerlink" title="配置文件"></a><blockquote style="border-left: 4px solid red;background: aqua;">配置文件</blockquote></h2><p>需要在主题的配置文件中作如下配置（themes/主题/_config.yml）<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">giteement:</span><br><span class="line">  enable: true</span><br><span class="line">  redirect_uri: https://wudong.tech</span><br><span class="line">  oauth_uri: https://wudong.tech/token</span><br><span class="line">  giteeID: &apos;&apos;</span><br><span class="line">  repo: &apos;&apos;</span><br><span class="line">  ClientID: &apos;&apos;</span><br><span class="line">  ClientSecret: &apos;&apos;</span><br></pre></td></tr></table></figure></p>
<p>enable:true|false 是否开启评论系统<br>redirect_uri:应用回调地址<br>oauth_uri: <a href="https://wudong.tech/token">https://wudong.tech/token</a> nginx代理获取token地址，如果使用作者配置的请在评论中留下你的域名。<br>giteeID: 你的码云账号英文名<br>ClientID，Client Secret： 码云配置第三方应用给的Client ID和Client Secret<br>repo： 评论项目的地址<br><img src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/repo%E9%85%8D%E7%BD%AE.png" alt></p>
<h2 id="修改主题模板"><a href="#修改主题模板" class="headerlink" title="修改主题模板"></a><blockquote style="border-left: 4px solid red;background: aqua;">修改主题模板</blockquote></h2><p>&emsp;&emsp;应用回调地址一般配置的是博客的首页，但是在浏览某篇博客的时候，需要评论，一般是在当前博客也登录，登录完在回到当前的博客进行评论。在跳转到码云的登录授权的页面，一般我们会传一个回调地址给码云，告诉他验证完在跳转到这个页面，但是码云只支持传过去的回调地址必须与应用配置的回调地址一致，才可以，这点跟Github不一样。但是可以将该博客的地址以bkurl参数传过去，然后在首页通过js转发到该bkurl地址，因此需要将下面的代码放在主题的index中。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&lt;script src=&quot;https://giteement.oss-cn-beijing.aliyuncs.com/oauthcallback.browser.js&quot;&gt;&lt;/script&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">  Oauthcallback();</span><br><span class="line">&lt;/script&gt;</span><br></pre></td></tr></table></figure></p>
<p>&emsp;&emsp;需要在每篇博客后面加上评论，因此展示博客的主题模板也要加上下面的代码<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">&lt;div id=&quot;giteementDiv&quot;&gt;&lt;/div&gt;</span><br><span class="line">&lt;link rel=&quot;stylesheet&quot; href=&quot;https://giteement.oss-cn-beijing.aliyuncs.com/default.css&quot;&gt;</span><br><span class="line">&lt;script src=&quot;https://giteement.oss-cn-beijing.aliyuncs.com/giteement.browser.js&quot;&gt;&lt;/script&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">var giteement = new Giteement(&#123;</span><br><span class="line">  id: &#123;&#123;date(page.date, &apos;YYYYMMDDHHmmss&apos;)&#125;&#125;,</span><br><span class="line">  owner: &apos;&#123;&#123;theme.giteement.giteeID&#125;&#125;&apos;,</span><br><span class="line">  repo: &apos;&#123;&#123;theme.giteement.repo&#125;&#125;&apos;,</span><br><span class="line">  backcall_uri: &apos;&#123;&#123;theme.giteement.redirect_uri&#125;&#125;&apos;,</span><br><span class="line">  oauth_uri: &apos;&#123;&#123;theme.giteement.oauth_uri&#125;&#125;&apos;,</span><br><span class="line">  oauth: &#123;</span><br><span class="line">    client_id: &apos;&#123;&#123;theme.giteement.ClientID&#125;&#125;&apos;,</span><br><span class="line">    client_secret: &apos;&#123;&#123;theme.giteement.ClientSecret&#125;&#125;&apos;</span><br><span class="line">  &#125;,</span><br><span class="line">&#125;)</span><br><span class="line">giteement.render(&apos;giteementDiv&apos;)</span><br></pre></td></tr></table></figure></p>
<p>&emsp;&emsp;以上的步骤完成的话基本上，你的评论系统就可以使用了。</p>
<h1 id="例子"><a href="#例子" class="headerlink" title="例子"></a>例子</h1><h2 id="主题landscape中使用"><a href="#主题landscape中使用" class="headerlink" title="主题landscape中使用"></a><blockquote style="border-left: 4px solid red;background: aqua;">主题<a href="https://github.com/hexojs/hexo-theme-landscape" target="_blank" rel="noopener">landscape</a>中使用</blockquote></h2><p>&emsp;&emsp;这个主题应该是Hexo安装后默认的主题。<br>&emsp;&emsp;修改themes/landscape/layout/index.ejs<br><img src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/landscape-index.png" alt><br>&emsp;&emsp;修改themes/landscape/layout/_partial/article.ejs<br><img src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/landscape-article.png" alt><br>&emsp;&emsp;增加themes/landscape/layout/_partial/comment.ejs<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">&lt;% if (!index &amp;&amp; post.comments &amp;&amp; theme.giteement.enable)&#123; %&gt;</span><br><span class="line">&lt;div id=&quot;giteementDiv&quot;&gt;&lt;/div&gt;</span><br><span class="line">&lt;link rel=&quot;stylesheet&quot; href=&quot;https://giteement.oss-cn-beijing.aliyuncs.com/default.css&quot;&gt;</span><br><span class="line">&lt;script src=&quot;https://giteement.oss-cn-beijing.aliyuncs.com/giteement.browser.js&quot;&gt;&lt;/script&gt;</span><br><span class="line">&lt;script&gt;</span><br><span class="line">var giteement = new Giteement(&#123;</span><br><span class="line">  id: &apos;&lt;%- post.date.format(&apos;YYYYMMDDHHmmss&apos;) %&gt;&apos;,</span><br><span class="line">  owner: &apos;&lt;%- theme.giteement.giteeID %&gt;&apos;,</span><br><span class="line">  repo: &apos;&lt;%- theme.giteement.repo %&gt;&apos;,</span><br><span class="line">  backcall_uri: &apos;&lt;%- theme.giteement.redirect_uri %&gt;&apos;,</span><br><span class="line">  oauth_uri: &apos;https://wudong.tech/token&apos;,</span><br><span class="line">  oauth: &#123;</span><br><span class="line">    client_id: &apos;&lt;%- theme.giteement.ClientID %&gt;&apos;,</span><br><span class="line">    client_secret: &apos;&lt;%- theme.giteement.ClientSecret %&gt;&apos;</span><br><span class="line">  &#125;,</span><br><span class="line">&#125;)</span><br><span class="line">giteement.render(&apos;giteementDiv&apos;)</span><br><span class="line">&lt;/script&gt;</span><br><span class="line">&lt;% &#125; %&gt;</span><br></pre></td></tr></table></figure></p>
<h2 id="主题next中使用"><a href="#主题next中使用" class="headerlink" title="主题next中使用"></a><blockquote style="border-left: 4px solid red;background: aqua;">主题<a href="https://github.com/theme-next/hexo-theme-next" target="_blank" rel="noopener">next</a>中使用</blockquote></h2><p>&emsp;&emsp;修改themes/next/layout/index.swig<br><img src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/next-index.png" alt><br>&emsp;&emsp;修改themes/next/layout/_partials/comments.swig<br><img src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/next-comments.png" alt></p>
<h1 id="待解决问题"><a href="#待解决问题" class="headerlink" title="待解决问题"></a>待解决问题</h1><ol>
<li>giteement的UI是直接使用gitment的UI，不是很好看，后期准备优化。</li>
<li>新增文章的时候需要登录自己的gitee账号，点击评论初始化按钮。<br><img src="https://giteement.oss-cn-beijing.aliyuncs.com/%E8%AF%84%E8%AE%BA%E6%B2%A1%E6%9C%89%E5%88%9D%E5%A7%8B%E5%8C%96.png" alt></li>
</ol>
<p><img src="https://giteement.oss-cn-beijing.aliyuncs.com/%E7%99%BB%E5%BD%95%E5%90%8E%E5%87%BA%E7%8E%B0%E5%88%9D%E5%A7%8B%E5%8C%96%E6%8C%89%E9%92%AE.png" alt></p>
<p><img src="https://giteement.oss-cn-beijing.aliyuncs.com/%E5%88%9D%E5%A7%8B%E5%8C%96%E5%AE%8C%E6%88%90%E5%90%8E.png" alt></p>
<h1 id="相关链接"><a href="#相关链接" class="headerlink" title="相关链接"></a>相关链接</h1><p><a href="https://github.com/imsun/gitment" target="_blank" rel="noopener">gitment</a><br><a href="https://imsun.net/posts/gitment-introduction/" target="_blank" rel="noopener">gitment介绍</a><br><a href="https://gitee.com/eillott/giteement" target="_blank" rel="noopener">giteement</a><br><a href="https://wudong.tech/2018/08/29/Hexo%E6%8E%A5%E5%85%A5%E7%A0%81%E4%BA%91%E8%AF%84%E8%AE%BA%E7%B3%BB%E7%BB%9F/">giteement介绍</a></p>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/博客/" rel="tag"># 博客</a>
          
            <a href="/tags/Hexo/" rel="tag"># Hexo</a>
          
            <a href="/tags/码云/" rel="tag"># 码云</a>
          
            <a href="/tags/评论系统/" rel="tag"># 评论系统</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/08/31/Nginx配置跨域请求/" rel="prev" title="Nginx配置码云token跨域请求">
                Nginx配置码云token跨域请求 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          
  
    <div id="giteementDiv"></div>
    <link rel="stylesheet" href="https://giteement.oss-cn-beijing.aliyuncs.com/default.css">
    <script src="https://giteement.oss-cn-beijing.aliyuncs.com/giteement.browser.js"></script>
    <script>
    var giteement = new Giteement({
      id: 20180829204849,
      owner: 'eillott',
      repo: 'eillott',
      backcall_uri: 'https://wudong.tech',
      oauth_uri: 'https://wudong.tech/token',
      oauth: {
        client_id: '11f02c3f93a28488215ae3c3fda47a5b94d8f60aea0fc1640ca88b353a150f6d',
        client_secret: '2786043fc3856082703cb7f8d63066aabecf5673b6cb4460d7343b860a8ddfd1'
      },
    })
    giteement.render('giteementDiv')
    </script>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="https://wudong-tech.oss-cn-beijing.aliyuncs.com/Hexo%E5%92%8C%E7%A0%81%E4%BA%91%E6%90%AD%E5%BB%BA%E5%B1%9E%E4%BA%8E%E8%87%AA%E5%B7%B1%E7%9A%84%E5%8D%9A%E5%AE%A2/%E5%BD%A4%E5%BD%A41.jpg" alt="吴栋">
            
              <p class="site-author-name" itemprop="name">吴栋</p>
              <p class="site-description motion-element" itemprop="description">技术博客，主攻Java，Python，nodeJS</p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">8</span>
                    <span class="site-state-item-name">日志</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  <a href="/categories/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">4</span>
                    <span class="site-state-item-name">分类</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  <a href="/tags/index.html">
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">16</span>
                    <span class="site-state-item-name">标签</span>
                  </a>
                </div>
              
            </nav>
          

          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#前言声明"><span class="nav-number">1.</span> <span class="nav-text">前言声明</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#背景"><span class="nav-number">1.1.</span> <span class="nav-text">背景</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#声明"><span class="nav-number">1.2.</span> <span class="nav-text">声明</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#使用"><span class="nav-number">2.</span> <span class="nav-text">使用</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#必要前提"><span class="nav-number">2.1.</span> <span class="nav-text">必要前提</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置第三方应用"><span class="nav-number">2.2.</span> <span class="nav-text">配置第三方应用</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置文件"><span class="nav-number">2.3.</span> <span class="nav-text">配置文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#修改主题模板"><span class="nav-number">2.4.</span> <span class="nav-text">修改主题模板</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#例子"><span class="nav-number">3.</span> <span class="nav-text">例子</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#主题landscape中使用"><span class="nav-number">3.1.</span> <span class="nav-text">主题landscape中使用</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#主题next中使用"><span class="nav-number">3.2.</span> <span class="nav-text">主题next中使用</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#待解决问题"><span class="nav-number">4.</span> <span class="nav-text">待解决问题</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#相关链接"><span class="nav-number">5.</span> <span class="nav-text">相关链接</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2022</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">吴栋</span>

  

  
</div>




  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动 v3.9.0</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Gemini</a> v6.4.0</div>




        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv" title="总访客量">
      <i class="fa fa-user"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
    </span>
  

  
    <span class="site-pv" title="总访问量">
      <i class="fa fa-eye"></i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
    </span>
  
</div>









        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>














  













  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/canvas-nest/canvas-nest.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.4.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.0"></script>



  



  










  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=6.4.0"></script>



  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  
  

  

  

  

  

  

</body>
</html>
